#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main()
{
    char buf[] = "Let's go!\n";

    int fd = open("data.txt", O_CREAT | O_WRONLY | O_TRUNC);
    printf("文件描述符: %d\n", fd);

    write(fd, buf, sizeof(buf) - 1);
    close(fd);
    return 0;
}